Article = require '../models/article'
async = require 'async'
db = require '../utils/connect'

sql = "select articles.* from articles join accounts on accounts.active = 1 and accounts.username = articles.username and articles.state=0 and articles.datetime > '2013-09-14'"
sql = "select * from articles_approved  where id not in ( select id from article_detail)"
sql = "select * from articles_approved  where cover not in ( select name from imgs)"
db.runSql sql, (err, result)->
	async.forEachSeries result, (article,cb)->
		Article.approve article.id, cb
	,(err)->
		console.log err
